<div xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:nxu="http://nuxeo.org/nxweb/util"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:nxl="http://nuxeo.org/nxforms/layout"
  xmlns:a4j="http://richfaces.org/a4j"
  class="popUpContent" id="popUpContent">

    <h:outputScript target="#{pageJsTarget}">
      function updateParent(documentUid, documentTitle) {
        parentInput = document.getElementById('createForm:objectDocumentUid');
        parentInput.value = documentUid;
        parentTitle = document.getElementById('createForm:objectDocumentTitle');
        parentTitle.innerHTML = documentTitle;
        parentTitleSaved = document.getElementById('createForm:objectDocumentTitleSaved');
        parentTitleSaved.value = documentTitle;
        hidePopUp();
      }
    </h:outputScript>

    <nxu:set var="contentViewName" value="relation_search">
    <nxu:set var="contentViewId" value="0">

      <div>
        <h3><h:outputText value="#{messages['label.search.form.simple']}" /></h3>
        <h:form>
          <nxu:set var="contentView"
            value="#{contentViewActions.getContentViewWithProvider(contentViewName)}"
            cache="true">
            <c:if test="#{contentView != null}">
              <nxl:layout name="#{contentView.searchLayout.name}" mode="search"
                value="#{contentView.searchDocumentModel}" />
            </c:if>

            <a4j:commandButton value="#{messages['command.search']}"
              action="#{contentViewActions.resetPageProvider(contentViewName)}"
              styleClass="button" id="searchButton" render="content">
              <!-- popupDisplayed flag for preventing relation_search content view execution until search button clicked -->
              <a4j:param value="true"
                assignTo="#{relationActions.popupDisplayed}" />
            </a4j:commandButton>
          </nxu:set>
        </h:form>
      </div>

      <a4j:outputPanel id="content" layout="block">
        <c:if test="#{relationActions.popupDisplayed}">
          <ui:decorate template="/incl/content_view.xhtml">
            <ui:param name="useAjaxPagination" value="true" />
            <ui:param name="contentIdToBeReRendered" value="content" />

            <ui:define name="content_view_syndication_buttons" />
            <ui:define name="content_view_selector">
              <div style="clear:both;" />
            </ui:define>
          </ui:decorate>
        </c:if>
      </a4j:outputPanel>
    </nxu:set>
    </nxu:set>
</div>
